#ifndef _DevicesSPI_H_
#define _DevicesSPI_H_

#define SPI1_DMA_READ_LENGTH  (256)
#define SPI1_DMA_SEND_LENGTH  (256)

#define SET_SPI1_NSS_HIGH() GPIO_SetBits(GPIOA, GPIO_PIN_15)
#define SET_SPI1_NSS_LOW()  GPIO_ResetBits(GPIOA, GPIO_PIN_15)



void vSPI1Init(void);
void vSPI1DMAInit(void);

uint8_t ucSPIWriteReadByte(SPI_Module* SPIx, uint8_t ucByte);
int8_t cSPIWriteDatas(SPI_Module* SPIx, uint8_t *pBuffer, int32_t iLength);
int8_t cSPIReadDatas(SPI_Module* SPIx, uint8_t *pBuffer, int32_t iLength);

//void vSPIxDMASetLenthStart(uint32_t dma_periph, dma_channel_enum channelx, uint32_t uiLength);
//void vSPIxDMASetAddrAndLenthStart(uint32_t dma_periph, dma_channel_enum channelx, int8_t cDirection, uint32_t uiSourceAddress, uint32_t uiTargetAddress, uint32_t uiLength);
//void vSPIxDMASendDatas(uint32_t uiUsartPeriph, uint8_t *pucDatas, int32_t iLength);


#endif
